﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Web.Configuration;
using System.Web.SessionState;
using System.Web;
namespace LAB
{
    public static class SysUtil
    {
        static List<string> sysEditors;
        static SysUtil()
        {
            sysEditors = new List<string>(ConfigurationManager.AppSettings["sysEditors"].Split(','));

        }

        /// <summary>
        /// 是不是系统管理员
        /// </summary>
        /// <param name="editor"></param>
        /// <returns></returns>
        public static bool isSysEditor(string editor)
        {
            return !string.IsNullOrEmpty(editor) && sysEditors.IndexOf(editor) != -1;
        }


        public static string getLoginInfo()
        {
            var user = HttpContext.Current.Session["userInfo"];
            return user != null ? user.ToString() : "";
        }

        public static void setLoginInfo(string userName)
        {
            HttpContext.Current.Session["userInfo"] = userName;
        }
    }
}
